package com.ruoyi.gateway.config;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;

/**
 * https://doc.ruoyi.vip/ruoyi-cloud/cloud/gateway.html#%E9%99%90%E6%B5%81%E9%85%8D%E7%BD%AE
 * 限流规则配置类
 */
@Configuration
public class KeyResolverConfiguration {
    @Bean
    public KeyResolver pathKeyResolver() {
        return exchange -> Mono.just(exchange.getRequest().getPath().value());
    }
}
